const express = require("express");
const bodyParser = require("body-parser");
const app = express();
app.use(express.static("./public"));
app.use("/node_modules", express.static("../node_modules"));

app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json()); 


app.get('/api/time', (req, res) => {
    res.header('Content-Type', 'application/json');
    let date = new Date().toLocaleDateString();
    res.json({
        message: 'success',
        data: {
            time: date
        },
    });
});

app.listen(8000, () => {
    console.log('listening 8000 ...');
})